﻿@{
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";

    var channels = ViewBag.Channels;
    var lstChannels = new SelectList(channels, "ChannelId", "Name");

    var importExcels = ViewBag.ImportExcels;
    var lstImportExcels = new SelectList(importExcels, "ImportId", "FilePath");

    var lstSchools = new SelectList(ViewBag.Schools, "SchoolId", "Name");
    var lstCampainTypes = new SelectList(ViewBag.CampainTypes, "Id", "Name");
    var lstStatusConnectTypes = new SelectList(ViewBag.StatusConnectTypes, "Id", "Name");
}
<style type="text/css">
    .acceptl1-table thead tr {
        height: 47px;
    }

    .acceptl1-table tbody tr td {
        vertical-align: middle !important;
    }
</style>
<div class="breadcrumbs" id="breadcrumbs">
    <script type="text/javascript">
        try {
            ace.settings.check('breadcrumbs', 'fixed');
        } catch (e) { }
    </script>

    <ul class="breadcrumb">
        <li>
            <i class="icon-home home-icon"></i>
            <a href="/Home">Trang chủ</a>
        </li>

        <li>
            <a href="javascript:void(0);">Campain</a>
        </li>
        <li class="active">Quản lý campain nháy số</li>
    </ul>
</div>

<div class="page-content">
    <div class="page-header">
        <h1>Quản lý campain nháy số								
        </h1>
    </div>
    <!-- /.page-header -->

    <div class="row">
        <div class="col-xs-12">
            <div id="spiner"></div>
        </div>
        <div class="col-xs-12">
            <!-- PAGE CONTENT BEGINS -->
            @using (Ajax.BeginForm("Index", "Campain", new AjaxOptions { HttpMethod = "POST" }, new { enctype = "multipart/form-data", @class = "form-horizontal", role = "form", id = "frmAcceptContactL1" }))
            {
                @Html.AntiForgeryToken()
                <div class="widget-box" style="opacity: 1; z-index: 0;">
                    <div class="widget-header widget-header-small">
                        <h5 class="smaller">Campain</h5>

                        <div class="widget-toolbar no-border">
                            <ul class="nav nav-tabs" id="myTab">
                                <li class="active">
                                    <a data-toggle="tab" href="#home">Campain</a>
                                </li>
                                <li class="">
                                    <a data-toggle="tab" href="#profile">Thông tin</a>
                                </li>
                                <li class="">
                                    <a data-toggle="tab" href="#info">Lọc Contact</a>
                                </li>
                                <li class="">
                                    <a data-toggle="tab" href="#store">Kho Campain</a>
                                </li>
                            </ul>
                        </div>
                    </div>

                    <div class="widget-body">
                        <div class="widget-main padding-6">
                            <div class="tab-content">
                                <div id="home" class="tab-pane active" style="padding: 0px 16px 0 0;">
                                    <button id="btnSubmit" class="btn-primary" style="margin-bottom: 10px;">Tạo Campain</button>
                                    <br />
                                    <div class="clear-fix"></div>
                                    <table id="grid-table"></table>
                                    <div id="grid-pager"></div>
                                </div>
                                <div id="profile" class="tab-pane">
                                    <div class="row">
                                        <div class="col-xs-1" style="width: 6%;">
                                            Mã
                                        </div>
                                        <div class="col-xs-3">
                                            <div class="clearfix">
                                                @Html.TextBox("Code", "CP_01", new { @style = "width: 100%", @readonly = "readonly" })
                                            </div>
                                        </div>
                                        <div class="col-xs-1" style="width: 11%;">
                                            Tên Campain<b style="color: red;">*</b>
                                        </div>
                                        <div class="col-xs-3">
                                            <div class="clearfix">
                                                @Html.TextBox("Name", "Nháy số 1", new { @style = "width: 100%" })
                                            </div>
                                        </div>
                                        <div class="col-xs-2" style="width: 13%;">
                                            Kiểu Campain
                                        </div>
                                        <div class="col-xs-2" style="width: 19%;">
                                            <div class="clearfix">
                                                @Html.DropDownList("CampainType", lstCampainTypes, new { @style = "width: 100%" })
                                            </div>
                                        </div>
                                    </div>
                                    <div class="space-6"></div>
                                    <div class="row">
                                        <div class="col-xs-1" style="width: 6%;">
                                            &nbsp;
                                        </div>
                                        <div class="col-xs-3">
                                            &nbsp;
                                        </div>
                                        <div class="col-xs-1" style="width: 11%;">
                                            Lịch hẹn gọi
                                        </div>
                                        <div class="col-xs-1">Ngày gọi</div>
                                        <div class="col-xs-2">
                                            @Html.TextBox("DateDay", DateTime.Now.ToString("dd/MM/yyyy"), new { @style = "width: 100%" })
                                        </div>
                                        <div class="col-xs-2" style="width: 13%;">
                                            Thời gian bắt đầu
                                        </div>
                                        <div class="col-xs-2" style="width: 19%;">
                                            <span class="input-append bootstrap-timepicker">
                                                @Html.TextBox("TimeStart", DateTime.Now.ToString("HH:mm"), new { @class = "input-small" })
                                                <span class="add-on"><i class="icon-time"></i></span>
                                            </span>
                                        </div>
                                    </div>
                                    <div class="space-2"></div>
                                    <div class="row">
                                        <div class="col-xs-6">
                                            &nbsp;
                                        </div>
                                        <div class="col-xs-2" style="width: 17%;">
                                            &nbsp;
                                        </div>
                                        <div class="col-xs-2" style="width: 13%;">
                                            Thời gian kết thúc
                                        </div>
                                        <div class="col-xs-2" style="width: 19%;">
                                            <span class="input-append bootstrap-timepicker">
                                                @Html.TextBox("TimeEnd", DateTime.Now.AddHours(4).ToString("HH:mm"), new { @class = "input-small" })
                                                <span class="add-on"><i class="icon-time"></i></span>
                                            </span>
                                        </div>
                                    </div>
                                    <div class="space-2"></div>
                                    <hr />
                                    <div class="space-2"></div>
                                    <button id="btnNext2" class="btn-primary" style="float: right; margin-left: 10px;">Tiếp theo</button>
                                    <button id="btnSave" class="btn-primary" style="float: right;">Lưu thông tin</button>
                                    <div class="clear-fix"></div>
                                    <br />
                                    <div class="space-6"></div>
                                </div>
                                <div id="info" class="tab-pane" style="padding: 0px 0px;">
                                    <div class="row">
                                        <div class="col-xs-1" style="width: 5%;">
                                            Gói
                                        </div>
                                        <div class="col-xs-3">
                                            <div class="clearfix">
                                                @Html.DropDownList("Code", lstImportExcels, new { @style = "width: 100%" })
                                            </div>
                                        </div>
                                        <div class="col-xs-1" style="width: 13%;">
                                            Ngày Import
                                        </div>
                                        <div class="col-xs-3">
                                            <div class="clearfix">
                                                @Html.TextBox("Name", DateTime.Now.ToString("dd/MM/yyyy"), new { @style = "width: 100%" })
                                            </div>
                                        </div>
                                        <div class="col-xs-1" style="width: 10%;">
                                            Đến ngày
                                        </div>
                                        <div class="col-xs-2">
                                            <div class="clearfix">
                                                @Html.TextBox("Name", DateTime.Now.ToString("dd/MM/yyyy"), new { @style = "width: 100%" })
                                            </div>
                                        </div>
                                    </div>
                                    <div class="space-6"></div>
                                    <div class="row">
                                        <div class="col-xs-1" style="width: 5%;">
                                            Kênh
                                        </div>
                                        <div class="col-xs-3">
                                            <div class="clearfix">
                                                @Html.DropDownList("Code", lstChannels, new { @style = "width: 100%" })
                                            </div>
                                        </div>
                                        <div class="col-xs-1" style="width: 13%;">
                                            Ngày thu thập
                                        </div>
                                        <div class="col-xs-3">
                                            <div class="clearfix">
                                                @Html.TextBox("Name", DateTime.Now.ToString("dd/MM/yyyy"), new { @style = "width: 100%" })
                                            </div>
                                        </div>
                                        <div class="col-xs-1" style="width: 10%;">
                                            Đến ngày
                                        </div>
                                        <div class="col-xs-2">
                                            <div class="clearfix">
                                                @Html.TextBox("Name", DateTime.Now.ToString("dd/MM/yyyy"), new { @style = "width: 100%" })
                                            </div>
                                        </div>
                                    </div>
                                    <div class="space-6"></div>
                                    <div class="row">
                                        <div class="col-xs-1" style="width: 5%;">
                                            Trường
                                        </div>
                                        <div class="col-xs-3">
                                            <div class="clearfix">
                                                @Html.DropDownList("Name", lstSchools, new { @style = "width: 100%" })
                                            </div>
                                        </div>
                                        <div class="col-xs-1" style="width: 13%;">
                                            Trạng thái kết nối
                                        </div>
                                        <div class="col-xs-3">
                                            <div class="clearfix">
                                                @Html.DropDownList("Name", lstStatusConnectTypes, new { @style = "width: 100%" })
                                            </div>
                                        </div>
                                        <div class="col-xs-1" style="width: 10%;">
                                            Loại contact
                                        </div>
                                        <div class="col-xs-2">
                                            @Html.CheckBox("Name", true) Mới&nbsp;&nbsp;
                                            @Html.CheckBox("Name", false) Tái sử dụng
                                        </div>
                                    </div>
                                    <div class="space-2"></div>
                                    <hr />
                                    <div class="space-2"></div>
                                    <button id="btnFilterContact" class="btn-primary" style="margin-bottom: 10px; float: right;">Lọc Contact</button>
                                    <div class="clearfix"></div>
                                    <div class="space-4"></div>
                                    <table id="grid-table-contact"></table>
                                    <div id="grid-pager-contact"></div>
                                    <div class="space-2"></div>
                                    <hr />
                                    <div class="space-2"></div>
                                    <div class="row">
                                        <div class="col-xs-7" style="color: blueviolet;">
                                            Số lượng hiện tại trong kho là: <b>250</b> contacts
                                        </div>
                                        <div class="col-xs-1" style="text-align: right;">
                                            Số lượng
                                        </div>
                                        <div class="col-xs-1">
                                            @Html.TextBox("Name", "100", new { @style = "width: 100%" })
                                        </div>
                                        <div class="col-xs-3">
                                            <button id="btnNext3" class="btn-primary" style="float: right; margin-left: 10px;">Tiếp theo</button>
                                            <button id="btnHandover" class="btn-primary" style="float: right;">Chuyển vào kho </button>
                                            <div class="clearfix"></div>
                                        </div>
                                    </div>
                                </div>
                                <div id="store" class="tab-pane" style="padding: 0px 0px;">
                                    <div class="row">
                                        <div class="col-xs-12">
                                            <table id="grid-table-store"></table>
                                            <div id="grid-pager-store"></div>
                                        </div>
                                    </div>
                                    <div class="space-2"></div>
                                    <hr />
                                    <div class="space-2"></div>
                                    <div class="row">
                                        <div class="col-xs-12">
                                            <button id="btnCallCenter" class="btn-primary" style="float: right; margin-left: 10px;">Gửi CallCenter </button>
                                            <button id="btnClear" class="btn-primary" style="float: right;">Xóa contact trong kho </button>
                                            <div class="clearfix"></div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            }
            <!-- PAGE CONTENT ENDS -->
        </div>
        <!-- /.col -->
    </div>
    <!-- /.row -->
</div>

<script type="text/javascript">
    var url = 'admin/api/contact/filterreuse?branchId={0}';
    var grid_selector = "#grid-table";
    var heades = ['Id', 'Mã', 'Tên', 'Ngày', 'Thời gian bắt đầu', 'Thời gian kết thúc', 'Trạng thái', 'Chức năng'];
    var model = [
        { name: 'Id', index: 'Id', editable: false, sorttype: 'string', editoptions: { disabled: true }, width: '0px' },
        { name: 'Fullname', index: 'Fullname', editable: false, sorttype: 'string', width: '100px' },
        { name: 'Fullname', index: 'Fullname', editable: false, sorttype: 'string', width: '100px' },
        { name: 'DateTime', index: 'DateTime', editable: true, sorttype: 'string', width: '80px' },
        { name: 'LocationId', index: 'LocationId', editable: true, sorttype: 'string', width: '80px' },
        { name: 'Mobile', index: 'Mobile', editable: false, sorttype: 'string', width: '80px' },
        { name: 'Email', index: 'Email', editable: false, sorttype: 'string', width: '80px' },
        { name: 'SchoolGrad', index: 'SchoolGrad', editable: false, sorttype: 'string', width: '80px' },
    ];

    var url_contact = 'admin/api/contact/filterrecovery?users={0}&type={1}&levels={2}&statusMapId={3}&statusCareId={4}&day={5}&branchId={6}';
    var grid_selector_contact = "#grid-table-contact";
    var heades_contact = ['Id', 'Họ và tên', 'SĐT', 'Email', 'Trường tốt nghiệp', 'Ngành đăng ký', 'Level', 'Nơi sống', 'Trường', 'Ghi chú', 'Người nhập', 'Ngày nhập'];
    var model_contact = [
        { name: 'Id', index: 'Id', editable: false, sorttype: 'string', width: '0px' },
        { name: 'Fullname', index: 'Fullname', editable: false, sorttype: 'string', width: '150px' },
        { name: 'Mobile', index: 'Mobile', editable: false, sorttype: 'string', width: '90px' },
        { name: 'Email', index: 'Email', editable: false, sorttype: 'string', width: '90px' },
        { name: 'SchoolName', index: 'SchoolName', editable: false, sorttype: 'string', width: '70px' },
        { name: 'MajorName', index: 'MajorName', editable: false, sorttype: 'string', width: '70px' },
        { name: 'Level', index: 'Level', editable: false, sorttype: 'string', width: '50px' },
        { name: 'LocationName', index: 'LocationName', editable: false, sorttype: 'string', width: '70px' },
        { name: 'Notes', index: 'Notes', editable: false, sorttype: 'string' },
        { name: 'ChannelName', index: 'ChannelName', editable: false, sorttype: 'string', width: '70px' },
        { name: 'RegisteredDate', index: 'RegisteredDate', editable: false, sorttype: 'string', width: '70px' },
        { name: 'School', index: 'School', editable: false, sorttype: 'string', width: '70px' }
    ];

    var url_store = 'admin/api/contact/filterrecovery?users={0}&type={1}&levels={2}&statusMapId={3}&statusCareId={4}&day={5}&branchId={6}';
    var grid_selector_store = "#grid-table-store";
    var heades_store = ['Id', 'Họ và tên', 'SĐT', 'Email', 'Trường tốt nghiệp', 'Ngành đăng ký', 'Level', 'Nơi sống', 'Trường', 'Ghi chú', 'Người nhập', 'Ngày nhập'];
    var model_store = [
        { name: 'Id', index: 'Id', editable: false, sorttype: 'string', width: '0px' },
        { name: 'Fullname', index: 'Fullname', editable: false, sorttype: 'string', width: '150px' },
        { name: 'Mobile', index: 'Mobile', editable: false, sorttype: 'string', width: '90px' },
        { name: 'Email', index: 'Email', editable: false, sorttype: 'string', width: '90px' },
        { name: 'SchoolName', index: 'SchoolName', editable: false, sorttype: 'string', width: '70px' },
        { name: 'MajorName', index: 'MajorName', editable: false, sorttype: 'string', width: '70px' },
        { name: 'Level', index: 'Level', editable: false, sorttype: 'string', width: '50px' },
        { name: 'LocationName', index: 'LocationName', editable: false, sorttype: 'string', width: '70px' },
        { name: 'Notes', index: 'Notes', editable: false, sorttype: 'string' },
        { name: 'ChannelName', index: 'ChannelName', editable: false, sorttype: 'string', width: '70px' },
        { name: 'RegisteredDate', index: 'RegisteredDate', editable: false, sorttype: 'string', width: '70px' },
        { name: 'School', index: 'School', editable: false, sorttype: 'string', width: '70px' }
    ];

    $(document).ready(function () {
        var branchId = 0;
        setupGridWithoutEdit("#grid-table", "#grid-pager", url.format(branchId), "admin/api/contact/edit", "Id", "Danh sách Campain", heades, model);
        setupGridWithoutEdit("#grid-table-contact", "#grid-pager-contact", url_contact.format(branchId), "admin/api/contact/edit", "Id", "Danh sách Contact", heades_contact, model_contact);
        setupGridWithoutEdit("#grid-table-store", "#grid-pager-store", url_contact.format(branchId), "admin/api/contact/edit", "Id", "Danh sách Contact trong Campain", heades_store, model_store);
        $(grid_selector).jqGrid("setGroupHeaders", {
            useColSpanStyle: true,
            groupHeaders: [
                { startColumnName: "DateTime", numberOfColumns: 3, titleText: '<table style="width:100%;border-spacing:0px;"><tr><td style="text-align:center;height:40px;"><b>Lịch gọi</b></td></tr></table>' }
            ]
        });

        $('#TimeEnd').timepicker();
        $('#TimeStart').timepicker();
        $('#DateDay').datepicker({ format: 'dd/mm/yyyy', autoclose: true, dateonly: true, endDate: "+0d" });
    });
</script>

